@echo off
set JDK_HOME=C:\Program Files\Java\jdk1.5.0_11\bin
set JAR_HOME=C:\Program Files\Java\jdk1.5.0_11\bin

:TEST_JDK
if exist "%JDK_HOME%"\javac.exe goto TEST_JAR
echo # javac.exe est introuvable au chemin defini pour le JDK_HOME (%JDK_HOME%) veuillez modifier la variable JDK_HOME #
goto FIN

:TEST_JAR
if exist "%JAR_HOME%"\jar.exe goto GENERATION
echo # jar.exe est introuvable au chemin defini pour le JAR_HOME (%JAR_HOME%) veuillez modifier la variable JAR_HOME #
goto FIN

:GENERATION
set destination=jar
mkdir %destination%
cd src

"%JDK_HOME%"javac -d ..\%destination% -classpath .;../lib/iaikPkcs11Wrapper.jar;../lib/log4j-1.2.16.jar -nowarn fr\asip\cps3\exemple\Lancement.java
cd ..
copy config\*.properties "%destination%"
cd %destination%
"%JAR_HOME%"jar cmf "..\MANIFEST.MF" programmeExempleCPS3.jar fr *.properties
cd ..
copy "%destination%\programmeExempleCPS3.jar" .
rmdir /S /Q %destination%


:FIN
pause